#include <iostream>
#include <vector>
#include <chrono>
#include <omp.h>  

int main() {
    const int n = 10000;
    std::vector<std::vector<double>> b(n, std::vector<double>(n, 1.0)); 
    std::vector<double> a(n, 1.0); 
    std::vector<double> sum(n, 0.0);
    auto start = std::chrono::high_resolution_clock::now();
    #pragma omp parallel for
    for (int i = 0; i < n; i++) {
        sum[i] = 0.0;
        for (int j = 0; j < n; j++) {
            sum[i] += b[j][i] * a[j]; 
        }
    }
    auto end = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> elapsed = end - start;
    std::cout << "第一个内积结果: " << sum[0] << std::endl;
    std::cout << "最后一个内积结果: " << sum[n - 1] << std::endl;
    std::cout << "计算耗时: " << elapsed.count() << " 秒" << std::endl;
    return 0;
}
